home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / security / xinetd / str.1.2.0 / str.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-14  |  2.4 KB  |  104 lines

  1. /*
  2.  * (c) Copyright 1992 by Panagiotis Tsirigotis
  3.  * All rights reserved.  The file named COPYRIGHT specifies the terms 
  4.  * and conditions for redistribution.
  5.  */
  6.  
  7.  
  8. #ifndef __STR_H
  9. #define __STR_H
  10.  
  11. /*
  12.  * $Id: str.h,v 1.5 1992/12/07 06:52:50 panos Exp $
  13.  */
  14.  
  15. #include <varargs.h>
  16.  
  17. /*
  18.  * Return values
  19.  */
  20. #define STR_OK                        0
  21. #define STR_ERR                    (-1)
  22.  
  23.  
  24. /* 
  25.  * Flags
  26.  */
  27. #define STR_NOFLAGS                0x0
  28. #define STR_RETURN_ERROR        0x1
  29. #define STR_NULL_START            0x2
  30. #define STR_NULL_END                0x4
  31. #define STR_MALLOC                0x8
  32.  
  33. extern int str_errno ;
  34.  
  35. /*
  36.  * Error values
  37.  */
  38. #define STR_ENULLSEPAR            1
  39. #define STR_ENULLSTRING            2
  40. #define STR_ENOMEM                3
  41.  
  42.  
  43. #ifdef __ARGS
  44. #undef __ARGS
  45. #endif
  46.  
  47. #ifdef PROTOTYPES
  48. #   define __ARGS( s )               s
  49. #else
  50. #   define __ARGS( s )               ()
  51. #endif
  52.  
  53.  
  54. /*
  55.  * strprint(3) functions
  56.  */
  57. char *str_sprint __ARGS( ( char *buf, char *fmt, ... ) ) ;
  58. int str_nprint __ARGS( ( char *buf, char *fmt, ... ) ) ;
  59. void str_print __ARGS( ( int *count, char *buf, char *fmt, ... ) ) ;
  60.  
  61. char *str_sprintv __ARGS( ( char *buf, char *fmt, va_list ) ) ;
  62. int str_nprintv __ARGS( ( char *buf, char *fmt, va_list ) ) ;
  63. void str_printv __ARGS( ( int *count, char *buf, char *fmt, va_list ) ) ;
  64.  
  65. char *strx_sprint __ARGS( ( char *buf, int len, char *fmt, ... ) ) ;
  66. int strx_nprint __ARGS( ( char *buf, int len, char *fmt, ... ) ) ;
  67. void strx_print __ARGS( ( int *count, char *buf, int len, char *fmt, ... ) ) ;
  68.  
  69. char *strx_sprintv __ARGS( ( char *buf, int len, char *fmt, va_list ) ) ;
  70. int strx_nprintv __ARGS( ( char *buf, int len, char *fmt, va_list ) ) ;
  71. void strx_printv __ARGS(( int *cnt, char *buf, int len, char *fmt, va_list )) ;
  72.  
  73.  
  74. /*
  75.  * strparse(3) functions
  76.  */
  77. typedef void *str_h ;
  78.  
  79. str_h str_parse __ARGS( ( char *str, char *separ, int flags, int *errnop ) ) ;
  80. void str_endparse __ARGS( ( str_h handle ) ) ;
  81. char *str_component __ARGS( ( str_h handle ) ) ;
  82. int str_setstr __ARGS( ( str_h handle, char *newstr ) ) ;
  83. int str_separator __ARGS( ( str_h handle, char *separ ) ) ;
  84. char *str_nextpos __ARGS( ( str_h handle ) ) ;
  85.  
  86. /*
  87.  * For backwards compatibility
  88.  */
  89. #define str_process( s, sep, flags )    str_parse( s, sep, flags, (int *)0 )
  90. #define str_endprocess( handle )            str_endparse( handle )
  91.  
  92.  
  93. /*
  94.  * strutil(3) functions
  95.  */
  96. char *str_find __ARGS( ( char *s1, char *s2 ) ) ;
  97. char *str_casefind __ARGS( ( char *s1, char *s2 ) ) ;
  98. void str_fill __ARGS( ( char *s, char c ) ) ;
  99. char *str_lower __ARGS( ( char *s ) ) ;
  100. char *str_upper __ARGS( ( char *s ) ) ;
  101.  
  102. #endif     /* __STR_H */
  103.  
  104.